<!--# layout("/common/leftmallout.html",{"jsBase":"/js/user/userAddress/"}){ -->
<link rel="stylesheet" href="http://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop/mall/style/member.css">
<script src="http://ziyunoss.oss-cn-hangzhou.aliyuncs.com/pop/mall/style/Validform_v5.3.2.js"></script>
<div class="center">
	<div class="section">
    	<!-------------面包屑--------------------->
           <br/>
        <!------------------主体结构--------------------->
        <div class="small-page">
         <!--左侧-->
        	
       <!-------左侧end-------->
       <!-------右侧-------->
            <div class="page-article">
            	<div class="area_mend_head">
                </div>
                <div class="area_mend_body">
                	<table class="area_mood_tanle">
                    	<thead>
                        	<tr>
                            	<td width="34%">收货地址</td>
                                <td width="14%">收货人</td>
                                <td width="14%">联系电话</td>
                                <td width="24%">操作</td>
                            </tr>
                        </thead>
                        <tbody class="tbodyAddress">
                        </tbody>
                    </table>
                   	
                    <!----------------------->	
                </div>
            </div>
       <!-------右侧end-------->
        </div>
        <!------------------->
    </div>
</div>


<!--#} -->
<script>
layui.use(['index'], function(){
	var lefthtml=$('.page-aside');
	var righthtml=$('.page-article');
	$('.small-page').empty();
	$('.small-page').append(lefthtml);
	$('.small-page').append(righthtml);
    var popUserAddressIndex = layui.index
    popUserAddressIndex.init();
   
});
</script>
<script src="http://www.11ziyun.com/js/region.js"></script>
<script type="text/javascript">

</script>

<script>
	$('.tbodyAddress').empty();
	var addressHtml="";
	$('.area_mend_head').empty();
	var headHtml="";
    doAjax('/user/userAddress/listAddressInfo.json','post','',function(res){
        
        for(var i=0;i<res.data.listUserAddress.length;i++){
        	var userAddress=res.data.listUserAddress[i];
        	if(userAddress.mobile == null || userAddress.mobile==""){
        		userAddress.mobile="无";
        	}
        	addressHtml+='<tr>'+
			        	'<td ><span>'+userAddress.addr+'</span></td>'+
			            '<td ><span>'+userAddress.name+'</span></td>'+
			            '<td ><span>'+userAddress.mobile+'</span></td>'+
			            '<td class="operation" >';
			if(userAddress.defAddr){
				addressHtml+='<i class="set_up_the" areaid="'+userAddress.addressId+'">取消默认地址 </i>';
			}else{
				addressHtml+='<i class="set_up_the" areaid="'+userAddress.addressId+'">设置默认地址 </i>';
			}            
			addressHtml+='<i class="editor" id_alter="'+userAddress.addressId+'">编辑</i>'+
			                '<i class="delete" areaid="'+userAddress.addressId+'">删除</i>'+
			           ' </td>'+
			        '</tr>';
        }
        $('.tbodyAddress').append(addressHtml);
        
        var addressCount=res.data.addressCount;
        if(addressCount>10){
        	headHtml+='<span>已有<strong class="price">'+addressCount+'</strong>收货地址</span> <em>| |  最多添加10个收货地址</em>';
        }else{
        	headHtml+='<span>已有<strong class="price">'+addressCount+'</strong>收货地址</span> <em>| |  最多添加10个收货地址</em>'
  			 +'<i class="member-more-r"> <a href="javascript:void(0)" class="zjshdz">添加收货地址</a></i>';
        }
        $('.area_mend_head').append(headHtml);
        
    },'');

$(document).on('click','.ico_check',function(){
	if(!$(this).hasClass('active'))
	{
		$(this).addClass('active');
		$(".check_add").val(1)

	}
	else{
		
		$(this).removeClass('active');
		$(".check_add").val(0)
	}
})

$('#receiver').css({'color':'#6647b2','font-weight':'900'});
</script>


